const http = uni.$u.http

// 获取商品基础信息
export const getShopDetail = (data, config = { custom: { type: 'ycMainUrl' }}) => http.post('/api/pc/product/productDetailByApp', data, config)
// 获取优惠信息
export const getCoupons = (data, config = { custom: { type: 'ycMainUrl' }}) => http.post('/api/mobile/coupon/queryCoupons', data, config)
// 获取相关产品
export const getReleShop = (data, config = { custom: { type: 'ycMainUrl' }}) => http.post('/api/pc/search/recommend', data, config)
// 收藏
export const CollectionShop = (data, config = { header: { 'Content-Type': 'application/x-www-form-urlencoded' }, custom: { type: 'ycMainUrl' }}) => http.post('/api/pc/membership/addMemberCollect', data, config)
// 领取优惠券
export const getReceCoupons = (data, config = { header: { 'Content-Type': 'application/x-www-form-urlencoded' }, custom: { type: 'ycMainUrl' }}) => http.post('/api/mobile/coupon/getCouponForBind', data, config)
// 取消收藏
export const cancelColl = (data, config = { header: { 'Content-Type': 'application/x-www-form-urlencoded' }, custom: { type: 'ycMainUrl' }}) => {
  return http.post('/api/pc/membership/deleteMemberCollect', data, config)
}
// 获取商品收藏状态
export const getCollList = (data, config = { custom: { type: 'ycMainUrl' }}) => {
  return http.post('/api/pc/membership/getGoodsIsCollect', data, config)
}
// 获取当前收藏商品信息
export const getCollId = (data, config = { header: { 'Content-Type': 'application/x-www-form-urlencoded' }, custom: { type: 'ycMainUrl' }}) => {
  return http.post('/api/pc/membership/getGoodIsCollect', data, config)
}
// 获取所有优惠券
export const getAllCoupon = (data, config = { header: { 'Content-Type': 'application/x-www-form-urlencoded' }, custom: { type: 'ycMainUrl' }}) => {
  return http.post('/api/pc/coupon/getCouponListByCustIdAndStatus', data, config)
}
// 获取购物车数量
export const getCarNum = (data, config = { custom: { type: 'ycMainUrl' }}) => {
  return http.post('/api/pc/cart/findShoppingCartCount', data, config)
}

// 获取商品类型
export const getProductTypeBySkuOrSpu = (data, config = { custom: { type: 'ycMainUrl' }}) =>
  http.post(`/api/pc/product/getProductTypeBySkuOrSpu?skuCode=${data.skuCode ?? ''}&spuCode=${data.spuCode ?? ''}`, {}, config)
// 获取临采商品基础信息
export const tempProductDetailByApp = (data, config = { custom: { type: 'ycMainUrl' }}) => http.post('/api/pc/product/tempProductDetailByApp', data, config)
// 获取一物多码商品基础信息
export const twinsProductDetailByApp = (data, config = { custom: { type: 'ycMainUrl' }}) => http.post('/api/pc/product/twinsProductDetailByApp', data, config)
// 获取供货商商品基础信息
export const providerProductDetailByApp = (data, config = { custom: { type: 'ycMainUrl' }}) => http.post('/api/pc/product/providerProductDetailByApp', data, config)
//商品详情分享数据统计
export const recordMemberShareLog = (params, config = { custom: { type: 'ycUrl' }}) => http.post('/product/share/recordMemberShareLog', params, config)